﻿package monopoly{
	import flash.display.Sprite;
	import fl.controls.*;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.EventDispatcher;
	
	import flash.display.Sprite;
	
	public class UserInput extends Sprite{
		private var ClientId:Label = new Label();
		private var ClientIdInp:TextInput = new TextInput();
		private var GameId:Label = new Label();
		private var GameIdInp:TextInput = new TextInput();
		private var serverHost:Label = new Label();
		private var serverHostInp:TextInput = new TextInput();
		private var StartBtn:Button = new Button();
		private var webHost:Label = new Label();
		private var webHostInp:TextInput = new TextInput();
		private var myIP:Label = new Label();
		private var myIPInp:TextInput = new TextInput();
		private var mySecKey:Label = new Label();
		private var mySecKeyInp:TextInput = new TextInput();
		
		public function UserInput():void{
			ClientId.text = "Set Client Id: ";
			ClientId.x = 10;
			ClientId.y = 20;
			GameId.text = "Set Game Id:";
			GameId.x = 10;
			GameId.y = 50;
			serverHost.text = "Set Game server host/IP";
			serverHost.x = 10;
			serverHost.y = 80;
			ClientIdInp.x = 300;
			ClientIdInp.y = 20;
			GameIdInp.x = 300;
			GameIdInp.y = 50;
			serverHostInp.x = 300;
			serverHostInp.y = 80;
			serverHostInp.text = "b-o-g-o.com";
			webHost.text = "Web Server Name:";
			webHost.x	 = 10;
			webHost.y	 = 110;
			webHostInp.x = 300;
			webHostInp.y = 110;
			webHostInp.text = "b-o-g-o.com";
			myIP.text	 = "Client IP:";
			myIP.x		 = 10;
			myIP.y		 = 140;
			myIPInp.x	 = 300;
			myIPInp.y	 = 140;
			myIPInp.text = "127.0.0.1";
			mySecKey.text= "Secret Key:";
			mySecKey.x	 = 10;
			mySecKey.y	 = 170;
			mySecKeyInp.x= 300;
			mySecKeyInp.y= 170;
			
			StartBtn.x = 30;
			StartBtn.y = 200;
			StartBtn.label = "Start";
			StartBtn.addEventListener(MouseEvent.CLICK, onStart); 
			addChild(ClientId);
			addChild(ClientIdInp);
			addChild(GameId);
			addChild(GameIdInp);
			addChild(serverHost);
			addChild(serverHostInp);
			addChild(webHost);
			addChild(webHostInp);
			addChild(myIP);
			addChild(myIPInp);
			addChild(mySecKey);
			addChild(mySecKeyInp);
			addChild(StartBtn);
		}
		public function get_ClientId():int{
			return  int(String(ClientIdInp.text));
			
		}
		public function get_GameId():int{
			return  int(String(GameIdInp.text));
			
		}
		
		public function get_serverHost():String{
			return String(serverHostInp.text);
		}
		public function get_WebHost():String {
			return String(webHostInp.text);
		}
		public function get_myIPAddrs():String {
			return String(myIPInp.text);
		}
		public function get_mySecKey():String {
			return String(mySecKeyInp.text);
		}
		
		public function onStart(ev:Event):void{
			dispatchEvent(new Event(Event.COMPLETE));
		}
	}
}